/*
RetroLeague - Mobile application for The Retro League Podcast
Copyright (C) 2010-2013 Hugues Johnson

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
the GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software 
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

package com.huguesjohnson.retroleague.util;

import com.huguesjohnson.retroleague.R;
import com.huguesjohnson.retroleague.StreamEntry.Sources;

import android.os.Environment;

public abstract class Utils{
	private static String downloadPath=null;
	
	public final static String getDownloadPath(){
		if(downloadPath==null){downloadPath=Environment.getExternalStorageDirectory().getPath()+"/RetroLeagueDownloads";}
		return(downloadPath);
	}
	
	public final static int getSourceIconId(Sources source){
		switch(source){
			case Podcast:{return(R.drawable.icon_podcast);}
			case Facebook:{return(R.drawable.icon_facebook);}
			case GooglePlus:{return(R.drawable.icon_googleplus);}
			case Twitter:{return(R.drawable.icon_twitter);}
			case YouTube:{return(R.drawable.icon_youtube);}
			case HJ:{return(R.drawable.icon_hj);}
			case Forums:{return(R.drawable.icon_forum);}
			case Tumblr:{return(R.drawable.icon_tumblr);}
			default:{return(R.drawable.icon);}
		}
	}
	
	public final static boolean isMediaFile(String fileName){
		int lastIndexOf=fileName.lastIndexOf('.');
		if(lastIndexOf>0){
			String ext=fileName.substring(lastIndexOf);
			return(
					ext.equalsIgnoreCase(".mp3")||
					ext.equalsIgnoreCase(".3gp")||
					ext.equalsIgnoreCase(".mp4")||
					ext.equalsIgnoreCase(".m4a")||
					ext.equalsIgnoreCase(".aac")||
					ext.equalsIgnoreCase(".flac")||
					ext.equalsIgnoreCase(".ogg")||
					ext.equalsIgnoreCase(".mkv")||
					ext.equalsIgnoreCase(".wav")||
					ext.equalsIgnoreCase(".webm")
					);
		}
		return(false);
	}
	
}